package cn.hejiang.mamis.core.service.impl;

import java.util.List;

import org.springframework.cache.annotation.CacheConfig;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import cn.hejiang.mamis.core.entity.SysDept;
import cn.hejiang.mamis.core.mapper.SysDeptMapper;
import cn.hejiang.mamis.core.service.SysDeptService;

@Service
@CacheConfig(keyGenerator = "cacheKeyGenerator")
public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> implements SysDeptService {
	@Cacheable(cacheNames = "SYS_DEPT")
	public List<SysDept> getDeptList(String sysId) {
		return this.getBaseMapper().getDeptList(sysId);
	}

	@CacheEvict(cacheNames = "SYS_DEPT", allEntries = true)
	public boolean save(SysDept entity) {
		return super.save(entity);
	}

	@CacheEvict(cacheNames = "SYS_DEPT", allEntries = true)
	public boolean update(SysDept entity, Wrapper<SysDept> updateWrapper) {
		return super.update(entity, updateWrapper);
	}

	@CacheEvict(cacheNames = "SYS_DEPT", allEntries = true)
	public boolean updateById(SysDept entity) {
		return super.updateById(entity);
	}
}
